var assert = require('assert');
var should = require('should');
var util = require('util');
var zlib = require('zlib');
var _ = require('lodash');
var exitHandler = require('../../../app/servers/copy/handler/exitHandler');
var config = require('../../config');

suite('测试copy.ExitHandler', function () {
    suite('battle exit handler check', function () {
        test('离开战斗成功', function (done) {
            var msg = {};
            msg.record_id = 10000;
            msg.damage_build_list = [{
                build_type: 10000
            }, {
                build_type: 12345
            }];
            msg.key = 1232353412;
            msg.verify = '9eae4275803f4378eaebcda00e2b4cf5';

            var session = {};
            session.get = function (key) {
                var map = {};
                map.sign = '111111';
                return map[key];
            };
            session.uid = config.role_id;

            var exit_handler = new exitHandler();
            exit_handler.exit(msg, session, function (err, res) {
                done();
            });
        });

        test('离开战斗成功', function (done) {
            var msg = {};
            msg.record_id = 10000;
            msg.destroy_build_list = [{
                build_type: 10000
            }, {
                build_type: 12345
            }];
            msg.economy_build_list = [];

            var session = {};
            session.uid = config.role_id;

            var exit_handler = new exitHandler();
            exit_handler.exit(msg, session, function (err, res) {
                done();
            });
        });
    });
});
